home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Morphos / GCC / lib / gcc-lib / ppc-amigaos / 2.95.1 / include / va-pa.h < prev    next >
C/C++ Source or Header  |  2000-03-13  |  2KB  |  53 lines

  1.  
  2. /* Define __gnuc_va_list. */
  3.  
  4. #ifndef __GNUC_VA_LIST
  5. #define __GNUC_VA_LIST
  6.  
  7. typedef void *__gnuc_va_list;
  8. #endif /* not __GNUC_VA_LIST */
  9.  
  10. /* If this is for internal libc use, don't define anything but
  11.    __gnuc_va_list.  */
  12. #if defined (_STDARG_H) || defined (_VARARGS_H)
  13. #if __GNUC__ > 1
  14. #define __va_ellipsis ...
  15. #define __gnuc_va_start(AP) ((AP) = (va_list)__builtin_saveregs())
  16. #else
  17. #define va_alist __va_a__, __va_b__, __va_c__, __va_d__
  18. #define __va_ellipsis 
  19. #define __gnuc_va_start(AP)\
  20.   (AP) = (double *) &__va_a__, &__va_b__, &__va_c__, &__va_d__, \
  21.   (AP) = (double *)((char *)(AP) + 4)
  22. #endif /* __GNUC__ > 1 */
  23.  
  24. /* Call __builtin_next_arg even though we aren't using its value, so that
  25.    we can verify that LASTARG is correct.  */
  26. #ifdef _STDARG_H
  27. #define va_start(AP,LASTARG) \
  28.   (__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
  29. #else
  30. /* The ... causes current_function_varargs to be set in cc1.  */
  31. #define va_dcl long va_alist; __va_ellipsis
  32. #define va_start(AP) __gnuc_va_start (AP)
  33. #endif
  34.  
  35. #define va_arg(AP,TYPE)                        \
  36.   (*(sizeof(TYPE) > 8 ?                        \
  37.    ((AP = (__gnuc_va_list) ((char *)AP - sizeof (int))),    \
  38.     (((TYPE *) (void *) (*((int *) (AP))))))            \
  39.    :((AP =                            \
  40.       (__gnuc_va_list) ((long)((char *)AP - sizeof (TYPE))    \
  41.             & (sizeof(TYPE) > 4 ? ~0x7 : ~0x3))),    \
  42.      (((TYPE *) (void *) ((char *)AP + ((8 - sizeof(TYPE)) % 4)))))))
  43.  
  44. #ifndef va_end
  45. void va_end (__gnuc_va_list);        /* Defined in libgcc.a */
  46. #endif
  47. #define va_end(AP)    ((void)0)
  48.  
  49. /* Copy __gnuc_va_list into another variable of this type.  */
  50. #define __va_copy(dest, src) (dest) = (src)
  51.  
  52. #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
  53.